<?php
namespace app\api\controller;
use app\parent\api;
use app\parent\parents;
use think\Controller;
use think\Loader;

class Test extends Controller{
	public function water()
	{	
		$image_base = \think\Image::open('./public/share/share_base.jpg');
		//宣传图剪裁
		$image_cover = \think\Image::open('./public/upload/weixin/20181204/00113677d093a155ad11748d3ad3aeaa.jpg');
		// 按照原图的比例生成一个最大为150*150的缩略图并保存为thumb.png
		$image_thumb = $image_cover->thumb(310,180,\think\Image::THUMB_CENTER)->save('./public/upload/weixin/20181204/thumb_00113677d093a155ad11748d3ad3aeaa.jpg');
		
		//二维码剪裁
		$image_cover->thumb(85,80,\think\Image::THUMB_CENTER)->save('./public/upload/weixin/20181204/ewm_00113677d093a155ad11748d3ad3aeaa.png');
		$water_one = $image_base->water('./public/upload/weixin/20181204/thumb_00113677d093a155ad11748d3ad3aeaa.jpg',\think\Image::WATER_NORTHWEST,100)->save('./public/upload/weixin/20181204/water_one_00113677d093a155ad11748d3ad3aeaa.jpg');
		$water_one = $image_base->water('./public/upload/weixin/20181204/ewm_00113677d093a155ad11748d3ad3aeaa.png',[164,200],100)->save('./public/upload/weixin/20181204/water_one_00113677d093a155ad11748d3ad3aeaa.jpg');
		$image_base1 = \think\Image::open('./public/upload/weixin/20181204/water_one_00113677d093a155ad11748d3ad3aeaa.jpg');
		$location = [12,200];
		$image_base1->text('为API开发设计的高性能框','simhei.ttf',11,'#636363',$location)->save('./public/upload/weixin/20181204/water_two_00113677d093a155ad11748d3ad3aeaa.jpg');
		$location1 = [12,240];
		$image_base1->text('朝阳区-海淀路','simhei.ttf',8,'#808080',$location1)->save('./public/upload/weixin/20181204/water_two_00113677d093a155ad11748d3ad3aeaa.jpg');
		$location2 =[12,280];
		$image_base1->text('11333万元','simhei.ttf',11,'#FF6347',$location2)->save('./public/upload/weixin/20181204/water_two_00113677d093a155ad11748d3ad3aeaa.jpg');
		$location3 = [170,284];
		$image_base1->text('长安扫码查看详情','simhei.ttf',7,'#808080',$location3)->save('./public/upload/weixin/20181204/water_two_00113677d093a155ad11748d3ad3aeaa.jpg');
		$water_one = $image_base->water('./public/upload/weixin/20181204/ewm_00113677d093a155ad11748d3ad3aeaa.png',[164,200],100)->save('./public/upload/weixin/20181204/water_one_00113677d093a155ad11748d3ad3aeaa.jpg');
		dump($image_cover);
		dump($image_base);
		dump($image_thumb);
		dump($water_one);
		//dump(21434);
		//
		//
	      // $image = \think\Image::open($path);
	      // $location=array(1100,2100);//坐标位置
	      // $image->water('./public/wechatma/'.$code.'.png',$location,100)->save('./public/wxcookie/'.$code.'.png');
	}
}
